using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using SubSonic;

namespace SurveyHost.Core.DAL
{
    public partial class MeasureController
    {
        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public MeasureCollection GetOrderedCollection()
        {
            return
                new MeasureCollection().
                    OrderByDesc(Measure.Columns.Rank).Load();
        }

        [DataObjectMethod(DataObjectMethodType.Update, true)]
        public void Update(Measure m)
        {
            m.MarkOld();
            m.Save();
        }

        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public void Delete(Measure m)
        {
            new MeasureController().Destroy(m.MeasureName);
        }

        [DataObjectMethod(DataObjectMethodType.Insert, true)]
        public void Add(Measure item)
        {
            item.Save();
        }

    }
}

